
function getPageScroll() {
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else {
		if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
			yScroll = document.documentElement.scrollTop;
		} else {
			if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
			}
		}
	}
	arrayPageScroll = yScroll;
	return arrayPageScroll;
}
function getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else {
		if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}
		}
	}	
	
	// for small pages with total height less then height of the viewport
	if (yScroll < windowHeight) {
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if (xScroll < windowWidth) {
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
	return arrayPageSize;
}
function showWindow(windowName) {
	var objOverlay = document.getElementById("overlay");
	var objWindow = document.getElementById(windowName);
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	objOverlay.style.height = (arrayPageSize[1] + "px");
	objOverlay.style.width = (arrayPageSize[0] + "px");
	objOverlay.style.display = "block";
	//selects = document.getElementsByTagName("select");
	//for (i = 0; i != selects.length; i++) {
	//	selects[i].style.visibility = "hidden";
	//}
	if (windowName == "loginWindow") {
		var showWidth = (arrayPageSize[2] / 2 - 150) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 130 + arrayPageScroll) + "px";
	}
	if (windowName == "registerWindow") {
		var showWidth = (arrayPageSize[2] / 2 - 225) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 260 + arrayPageScroll) + "px";
	}
	if (windowName == "newtopicWindow") {
		var showWidth = (arrayPageSize[2] / 2 - 325) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 200 + arrayPageScroll) + "px";
	}
	if (windowName == "newpostWindow") {
		var showWidth = (arrayPageSize[2] / 2 - 325) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 200 + arrayPageScroll) + "px";
	}
	if (windowName == "addFriendDialog") {
		var showWidth = (arrayPageSize[2] / 2 - 150) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 100 + arrayPageScroll) + "px";
	}
	if (windowName == "addFavoriteDialog") {
		var showWidth = (arrayPageSize[2] / 2 - 150) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 100 + arrayPageScroll) + "px";
	}
	if (windowName == "message") {
		var showWidth = (arrayPageSize[2] / 2 - 100) + "px";
		var showHeight = (arrayPageSize[3] / 2 - 80 + arrayPageScroll) + "px";
	}
	
	objWindow.style.display = "block";
	objWindow.style.top = showHeight;
	objWindow.style.left = showWidth;
}
function hideWindow(windowName) {
	objOverlay = document.getElementById("overlay");
	objWindow = document.getElementById(windowName);
	objOverlay.style.display = "none";
	objWindow.style.display = "none";
	//selects = document.getElementsByTagName("select");
	//for (i = 0; i != selects.length; i++) {
	//	selects[i].style.visibility = "visible";
	//}
}
function getSelected(object, ovalue) {
	var i;
	for (i = 0; i < object.length; i++) {
		if (object[i].value == ovalue) {
			object[i].selected = true;
		}
	}
}

<!--板块折叠-->
function collapseForum(listid,imgid){
   			var img=document.getElementById(imgid);
   			var size=listid.length;
   			if(img.unselectable=="on"){
   				img.unselectable="off"
   				img.src="images/ico/expand.gif";
   				for(var i=0;i<=size;i++){
   					obj=document.getElementById(listid[i]);
   					obj.style.display="none";
   				}
   			}else{
   				img.unselectable="on"
   				img.src="images/ico/collapse.gif";
   				for(var i=0;i<=size;i++){
   					obj=document.getElementById(listid[i]);
   					obj.style.display="block";
   				}
   			}
		}
